package drive.Mapper;

import drive.Model.ArticleImage;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface ArticleImageMapper {

    @Select("SELECT * FROM article_image")
    List<ArticleImage> findAll();

    @Select("SELECT * FROM article_image WHERE articleID = #{articleID}")
    List<ArticleImage> findByArticleID(Integer articleID);

    @Select("SELECT * FROM article_image WHERE imageID = #{imageID}")
    List<ArticleImage> findByImageID(Integer imageID);

    @Insert("INSERT INTO article_image (articleID, imageID) VALUES (#{articleID}, #{imageID})")
    int add(ArticleImage articleImage);

    @Delete("DELETE FROM article_image WHERE articleID = #{articleID} AND imageID = #{imageID}")
    int delete(Integer articleID, Integer imageID);


}